home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update28.zoo / lib / diffc < prev    next >
Encoding:
Text File  |  1993-02-22  |  52.3 KB  |  2,297 lines

  1. ===================================================================
  2. RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/Changelo,v
  3. retrieving revision 1.86
  4. diff -c -r1.86 Changelo
  5. *** 1.86    1992/12/28 07:52:43
  6. --- Changelo    1993/02/22 17:57:37
  7. ***************
  8. *** 3474,3476 ****
  9. --- 3474,3620 ----
  10.           wait.h (WSTOPPED): use expected value
  11.   
  12.   ---------------------------- Patchlevel 86 ---------------------------
  13. + _cmpsf2.s _divsf3.cpp _extends.cpp _mulsf3.cpp
  14. + _negsf2.s _normsf.cpp : olaf
  15. +     completed impl of NaN and infinities, even for floats.
  16. +     thanks olaf!
  17. + atof.c, doprnt.c:: andreas
  18. +     I have implemented improved floating point formatting/scanning
  19. +     routines for the mc68881. They use the builtin packed decimal
  20. +     format, which gives a precision of 17 decimal digits. Formatted and
  21. +     rescanned numbers now give identical results, and enquire reports no
  22. +     problems anymore.
  23. + string.h:: ++jrb
  24. +     add parens to shut up gcc.
  25. + doprnt.c:: Howard Chu
  26. +     The patch to doprnt makes it less vulnerable to crashing when handed
  27. +     a large floating point value. (Took me a while to figure out why I was
  28. +     crashing, around address 0x30303030!  }-)  Basically, my math routine
  29. +     returned a value like 0x7ff12345 0x60000000 which is larger than INF
  30. +     but less than NaN. The check I put in makes it print this range of
  31. +     numbers as NaN or -NaN, which is what the Sun C library does.
  32. + falcon.h: ++entropy
  33. +     Protected against multiple #include's.
  34. + string.h: ++entropy
  35. +     Added some parens to appease gcc -Wall with gcc 2.3.1.
  36. + getuid.c: ++boender@dutiws.twi.tudelft.nl, ++entropy
  37. +     Only negative returns from Psetuid() and Psetgid() indicate
  38. +     an error.  Positive returns indicate success (the PID is
  39. +     returned from the OS).  Modified getuid() and setgid() accordingly.
  40. + a64l.c: ++boender@dutiws.twi.tudelft.nl
  41. +     NEW module for conversion between longs and base-64 ASCII strings.
  42. + a64l.c: ++entropy
  43. +     Use __PROTO, use compiler.h, etc.
  44. + support.h: ++entropy
  45. +     Added prototypes for a64l(), l64a().
  46. + support.h: ++boender@dutiws.twi.tudelft.nl, ++entropy
  47. +     Fixed prototype for link().  Removed protoype for isatty()
  48. +     (it exists in unistd.h)
  49. + limits.h: ++entropy
  50. +     Added #define PASS_MAX 8.
  51. + getpass.c: ++entropy
  52. +     Fixed to use PASS_MAX, fixed off-by-one-error (was writing past end
  53. +     of static buf, very bad news).  Removed some small kludges.
  54. + fflush.c: ++boender@dutiws.twi.tudelft.nl, ++entropy
  55. +     Return EOF instead of 0 for files that aren't open.
  56. + mincl: ++jrb
  57. +     add new target for a64l.o
  58. + alloca.s, bcopy.s: ++dsb@cs.duke.edu
  59. +     RENAME to alloca.cpp, bcopy.cpp so we can do conditional compilation.
  60. + alloca.cpp, bcopy.cpp, bzero.cpp: ++dsb
  61. +     Changes for HSC.
  62. + mincl:
  63. +     Account for the name changes.
  64. + compiler.h: ++dsb
  65. +     Rearrange the __SOZOBONC__ #defines, fix a typo.
  66. + ctime.c, fscanf.c, sscanf.c: ++dsb
  67. +     Make compatible with HSC.
  68. + compiler.h: ++hohmuth
  69. +     define __TCC_GEMLIB__ when used with Pure/Turbo C
  70. + aesbind.h, gemfast.h: ++hohmuth
  71. +     Make it useable with Pure's GEM library.  The special declarations
  72. +     in aesbind.h check for __TCC_GEMLIB__.  Improved compatibility with
  73. +     Turbo's GEM declarations when __TCC_COMPAT__ is defined.
  74. + osbind.h: ++hohmuth
  75. +     Fix typos, add macros for sloppier type checking when used with 
  76. +     Pure C.
  77. + strupr.c: ++hohmuth
  78. +     NEW file:  add library call strupr().
  79. + string.h: ++hohmuth
  80. +     Add declaration of strupr().
  81. + mincl, lattice/mincl.lcc, purec/mintlib.prj, sozobon/makefile:
  82. +     Add strupr.c.
  83. + doprnt.c: ++Ulf_Moeller@hh2.maus.de
  84. +     Fix up the ARG macro (which tends to produce wrong results with Pure
  85. +     C (which uses a type conversion scheme within ?: that differs from
  86. +     GCC)).
  87. + regexp.c: ++hohmuth
  88. +     Make it Turbo/PureC-proof.
  89. + ctime.c: ++hohmuth
  90. + falcon.h: ++hyc@hanauma.jpl.nasa.gov
  91. +     Remove superfluous equals sign in enum declaration.
  92. + fread.c: ++ulf
  93. +     Fix return value for text mode.
  94. + times.c, times.h: ++ulf
  95. +     Use long return value instead of int.  This allows larger values
  96. +     and agrees with the SysV man page. Returns realtime since epoch
  97. +     like sysV (rather than 0,1,-1 like bsd as it previously did)
  98. + strlwr/strupr.c:: ++jrb
  99. +     bulletproof a little.
  100. + a64l.c: ++boender@dutiws.twi.tudelft.nl
  101. +     Add to comments a note that prototypes are in support.h.
  102. + getpass.c:
  103. +     Read password from /dev/tty, instead of stdin, if MiNT is active.
  104. + support.h:
  105. +     Functions link(), symlink() now take "const char *" instead of
  106. +     "char *" parmeters.
  107. + access.c: ++boender, ++entropy
  108. +     Use real, not effective, user id's for access() checks.
  109. +     Fix so access() always returns success on existing files if real
  110. +     user id is 0 (root), regardless of file mode.
  111. + mintbind.h:
  112. +     Add new GEMDOS functions (macros) Dgetcwd() and Salert().
  113. + errno.h: ++boender
  114. +     Define ENODEV as alias for EUKDEV/EUNDEV.
  115. + ---------------------------- Patchlevel 87 ---------------------------
  116. ===================================================================
  117. RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/PatchLev.h,v
  118. retrieving revision 1.62
  119. diff -c -r1.62 PatchLev.h
  120. *** 1.62    1992/12/28 07:52:46
  121. --- PatchLev.h    1993/02/17 23:57:55
  122. ***************
  123. *** 1,5 ****
  124.   
  125. ! #define    PatchLevel "86"
  126.   
  127.   /*
  128.    *
  129. --- 1,5 ----
  130.   
  131. ! #define    PatchLevel "87"
  132.   
  133.   /*
  134.    *
  135. ===================================================================
  136. RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/mincl,v
  137. retrieving revision 1.24
  138. diff -c -r1.24 mincl
  139. *** 1.24    1992/12/28 07:52:50
  140. --- mincl    1993/02/17 23:58:01
  141. ***************
  142. *** 34,42 ****
  143.   
  144.   #
  145.   # other portable stuff
  146. ! PORT =  alphasor.o abs.o catch.o dirent.o findfile.o ftw.o getpw.o \
  147.       getlogin.o getopt.o getpass.o ident.o mktemp.o scandir.o strlwr.o \
  148. !     strrev.o regexp.o regsup.o textio.o random.o obstack.o \
  149.       il.o ic.o iw.o ig.o ip.o frwbin.o
  150.   #
  151.   # the string library
  152. --- 34,42 ----
  153.   
  154.   #
  155.   # other portable stuff
  156. ! PORT =  a64l.o alphasor.o abs.o catch.o dirent.o findfile.o ftw.o getpw.o \
  157.       getlogin.o getopt.o getpass.o ident.o mktemp.o scandir.o strlwr.o \
  158. !     strrev.o strupr.o regexp.o regsup.o textio.o random.o obstack.o \
  159.       il.o ic.o iw.o ig.o ip.o frwbin.o
  160.   #
  161.   # the string library
  162. ***************
  163. *** 106,112 ****
  164.   
  165.   
  166.   # other dependencies
  167. - bcopy.o : bcopy.s
  168.   atof.o  : flonum.h
  169.   
  170.   #
  171. --- 106,111 ----
  172. ===================================================================
  173. RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/times.c,v
  174. retrieving revision 1.3
  175. diff -c -r1.3 times.c
  176. *** 1.3    1990/03/09 03:28:00
  177. --- times.c    1993/02/17 23:58:04
  178. ***************
  179. *** 5,18 ****
  180.   extern clock_t    _sys_runtime;
  181.   extern clock_t    _child_runtime;
  182.   
  183. ! int
  184.   times(struct tms *buffer)
  185.   {
  186. !     if (!buffer) return 1;
  187. !     buffer->tms_cutime = (time_t) (_child_runtime * HZ / CLK_TCK);
  188. !     buffer->tms_cstime = (time_t) 0;
  189. !     buffer->tms_stime = (time_t) (_sys_runtime * HZ / CLK_TCK);
  190. !     buffer->tms_utime = (time_t)
  191. !         ((clock() - _sys_runtime - _child_runtime) * HZ / CLK_TCK);
  192. !     return 0;
  193.   }
  194. --- 5,22 ----
  195.   extern clock_t    _sys_runtime;
  196.   extern clock_t    _child_runtime;
  197.   
  198. ! long
  199.   times(struct tms *buffer)
  200.   {
  201. !     long real_time = clock();
  202. !     if (!buffer)
  203. !     return -1L;
  204. !     buffer->tms_cutime = (time_t) (_child_runtime * HZ / CLK_TCK);
  205. !     buffer->tms_cstime = (time_t) 0;
  206. !     buffer->tms_stime = (time_t) (_sys_runtime * HZ / CLK_TCK);
  207. !     buffer->tms_utime = (time_t)
  208. !         ((real_time - _sys_runtime - _child_runtime) * HZ / CLK_TCK);
  209. !     return real_time;
  210.   }
  211. ===================================================================
  212. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_cmpsf2.s,v
  213. retrieving revision 1.3
  214. diff -c -r1.3 _cmpsf2.s
  215. *** 1.3    1992/10/09 20:35:29
  216. --- _cmpsf2.s    1993/01/13 14:30:36
  217. ***************
  218. *** 1,49 ****
  219.   | single floating point compare routine
  220.   |
  221. ! | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
  222. ! | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
  223.   |
  224. - |
  225. - | Revision 1.1, kub 12-89 :
  226. - | Created single float version for 68000
  227. - |
  228. - | Revision 1.0:
  229. - | original 8088 code from P.S.Housel for double floats
  230.   
  231.       .text
  232.       .even
  233.       .globl    __cmpsf2, ___cmpsf2
  234. -     | additional entry points for gcc2
  235. -     .globl    ___eqsf2, ___nesf2, ___gtsf2, ___gesf2, ___ltsf2, ___lesf2
  236.   
  237.   __cmpsf2:
  238.   ___cmpsf2:
  239.   ___eqsf2:
  240.   ___nesf2:
  241.   ___gtsf2:
  242. ! ___gesf2:
  243. ! ___ltsf2:
  244. ! ___lesf2:
  245. !     moveml    sp@(4),d0-d1    | get u and v
  246. !     tstl    d1        | check sign bit
  247.       bpl    1f
  248.       negl    d1        | negate
  249.       bchg    #31,d1        | toggle sign bit
  250. ! 1:
  251.       tstl    d0        | check sign bit
  252.       bpl    2f
  253.       negl    d0        | negate
  254.       bchg    #31,d0        | toggle sign bit
  255. ! 2:
  256. !     cmpl    d1,d0
  257. !     blt    lt
  258. !     bgt    gt
  259. ! eq:
  260. !     clrl    d0
  261.       rts
  262. ! lt:
  263. !     moveq    #-1,d0
  264.       rts
  265. ! gt:
  266. !     moveq    #1,d0
  267.       rts
  268. --- 1,135 ----
  269.   | single floating point compare routine
  270.   |
  271. ! | written by Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de)
  272. ! | Based on a 68k floating point packet from Kai-Uwe Bloem, itself based
  273. ! | on a 80x86 floating point packet from comp.os.minix, written by P.Housel
  274. ! | 
  275. ! | Revision 2.0: olaf 12-92.
  276.   |
  277.   
  278.       .text
  279.       .even
  280. +     .globl    ___eqsf2, ___nesf2
  281. +     .globl    ___gtsf2, ___lesf2
  282. +     .globl    ___gesf2, ___ltsf2
  283. +     | additional entry points for gcc 1.X    
  284.       .globl    __cmpsf2, ___cmpsf2
  285.   
  286.   __cmpsf2:
  287.   ___cmpsf2:
  288.   ___eqsf2:
  289.   ___nesf2:
  290. +     moveml    sp@(4),d0-d1    | get numbers to compare with
  291. +     tstl    d0        | check sign bit
  292. +     bpl    1f
  293. +     negl    d0
  294. +     bchg    #31,d0        | toggle sign bit
  295. + 1:    tstl    d1        | check sign bit
  296. +     bpl    2f
  297. +     negl    d1        | negate
  298. +     bchg    #31,d1        | toggle sign bit
  299. + 2:    cmpl    d1,d0
  300. +     bne    4f
  301. +     bclr    #31,d1
  302. +     cmpl    #0x7f800000,d1        | NaN is not equal NaN !
  303. +     bgt    4f
  304. +     clrl    d0
  305. +     rts
  306. + 4:    moveql    #1,d0
  307. +     rts
  308.   ___gtsf2:
  309. !     moveml    sp@(4),d0-d1    | get numbers to compare with
  310. !     tstl    d0        | check sign bit
  311.       bpl    1f
  312. +     negl    d0        | negate
  313. +     bchg    #31,d0        | toggle sign bit
  314. + 1:    tstl    d1        | check sign bit
  315. +     bpl    2f
  316.       negl    d1        | negate
  317.       bchg    #31,d1        | toggle sign bit
  318. ! 2:    cmpl    d1,d0
  319. !     bgt    4f        | d0 > d1 Test if NaN (should be false!)
  320. ! 3:    clrl    d0        | Test is false.
  321. !     rts
  322. ! 4:    bclr    #31,d0        
  323. !     cmpl    #0x7f800000,d0    | First operand == NaN =?
  324. !     bgt    3b
  325. !     moveql    #1,d0        | Test True
  326. !     rts
  327. ! ___lesf2:
  328. !     moveml    sp@(4),d0-d1    | get numbers to compare with
  329.       tstl    d0        | check sign bit
  330. +     bpl    1f
  331. +     negl    d0        | negate
  332. +     bchg    #31,d0        | toggle sign bit
  333. + 1:    tstl    d1        | check sign bit
  334.       bpl    2f
  335. +     negl    d1        | negate
  336. +     bchg    #31,d1        | toggle sign bit
  337. + 2:    cmpl    d1,d0
  338. +     ble    4f
  339. + 3:    moveql    #1,d0        | Test is false
  340. +     rts
  341. + 4:    bclr    #31,d0        
  342. +     cmpl    #0x7f800000,d0    | First operand == NaN =?
  343. +     bgt    3b
  344. +     clrl    d0        | Test true
  345. +     rts
  346. + ___gesf2:
  347. +     moveml    sp@(4),d0-d1    | get numbers to compare with
  348. +     tstl    d0        | check sign bit
  349. +     bpl    1f
  350.       negl    d0        | negate
  351.       bchg    #31,d0        | toggle sign bit
  352. ! 1:    tstl    d1        | check sign bit
  353. !     bpl    2f
  354. !     negl    d1        | negate
  355. !     bchg    #31,d1        | toggle sign bit
  356. ! 2:    cmpl    d1,d0
  357. !     bge    4f
  358. ! 3:    moveql    #-1,d0        | False
  359.       rts
  360. ! 4:    bclr    #31,d0        
  361. !     cmpl    #0x7f800000,d0    | First operand == NaN =?
  362. !     bgt    3b
  363. !     clrl    d0        | Test True
  364. !     rts
  365. ! ___ltsf2:
  366. !     moveml    sp@(4),d0-d1    | get numbers to compare with
  367. !     tstl    d0        | check sign bit
  368. !     bpl    1f
  369. !     negl    d0        | negate
  370. !     bchg    #31,d0        | toggle sign bit
  371. ! 1:    tstl    d1        | check sign bit
  372. !     bpl    2f
  373. !     negl    d1        | negate
  374. !     bchg    #31,d1        | toggle sign bit
  375. ! 2:    cmpl    d1,d0
  376. !     blt    4f
  377. ! 3:    clrl    d0
  378.       rts
  379. ! 4:    bclr    #31,d0        
  380. !     cmpl    #0x7f800000,d0    | First operand == NaN =?
  381. !     bgt    3b
  382. ! 5:    moveql    #-1,d0        | Test True
  383.       rts
  384. ===================================================================
  385. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_divsf3.cpp,v
  386. retrieving revision 1.3
  387. diff -c -r1.3 _divsf3.cpp
  388. *** 1.3    1992/12/18 16:35:40
  389. --- _divsf3.cpp    1993/01/13 14:30:38
  390. ***************
  391. *** 45,50 ****
  392. --- 45,54 ----
  393.   | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
  394.   | patched by Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de)
  395.   |
  396. + | Revision 1.2.2 olaf 12-92
  397. + |   + added support for NaN and Infinites
  398. + |   + added support for -0
  399. + |
  400.   | Revision 1.2.1 olaf 11-92
  401.   |   + prevent the tie rounding case if dividing is not exact.
  402.   |      > paranoia now says: "Division appears to round correctly"
  403. ***************
  404. *** 78,84 ****
  405.       andw    #0xff,d1    | kill sign bit
  406.   
  407.       andl    #0x7fffff,d4    | remove exponent from u.mantissa
  408. !     tstw    d0        | check for zero exponent - no leading "1"
  409.       beq    0f
  410.       orl    #0x800000,d4    | restore implied leading "1"
  411.       bra    1f
  412. --- 82,150 ----
  413.       andw    #0xff,d1    | kill sign bit
  414.   
  415.       andl    #0x7fffff,d4    | remove exponent from u.mantissa
  416. !     andl    #0x7fffff,d5    | remove exponent from v.mantissa
  417. ! |
  418. ! |
  419. ! |
  420. !     cmpb    #0xff,d0    
  421. !     beq    0f        |u == NaN || u== Inf
  422. !     cmpb    #0xff,d1
  423. !     beq    1f        | v == NaN || v == Inf
  424. !     tstb    d0
  425. !     bne    3f        | u not zero nor denorm
  426. !     tstl    d4
  427. !     beq    2f        | 0/ ?
  428. !     
  429. ! 3:    tstw    d1
  430. !     bne    nospec
  431. !     tstl    d5
  432. !     bne    nospec
  433. !     bra    retinf        | x/0 -> +/- Inf
  434. ! 0:    tstl    d4        | u == NaN ?
  435. !     bne    retnan        | NaN/ x
  436. !     cmpb    #0xff,d1    
  437. !     beq    retnan        | Inf/Inf or Inf/NaN 
  438. !     bra    retinf        | Inf/x | x != Inf && x != NaN
  439. ! 1:    tstl    d5
  440. !     bne    retnan        | x/NaN
  441. !     bra    retzero        | x/Inf -> +/- 0
  442. ! 2:    tstw    d1
  443. !     bne    retzero        | 0/x ->+/- 0
  444. !     tstl    d4
  445. !     bne    retzero        | 0/x 
  446. !     bra    retnan        | 0/0
  447. ! |
  448. ! |    Return Infinity with correct sign
  449. ! |    
  450. ! retinf:    tstl    d2
  451. !     bpl    0f
  452. !     movel    #0xff800000,d0
  453. ! return:    moveml    sp@+,d2-d5
  454. !     rts
  455. ! 0:    movel    #0x7f800000,d0
  456. !     bra    return    
  457. ! |
  458. ! |    Return NaN
  459. ! |
  460. ! retnan: movel    #0x7fffffff,d0
  461. !     bra    return
  462. ! |
  463. ! |    Return correct signed zero
  464. ! |
  465. ! retzero:clrl    d0        | zero destination
  466. !     tstl    d2
  467. !     bmi    return
  468. !     bset    #31,d0
  469. !     bra    return
  470. ! |
  471. ! |    End of special handling
  472. ! |    
  473. ! nospec:    tstw    d0        | check for zero exponent - no leading "1"
  474.       beq    0f
  475.       orl    #0x800000,d4    | restore implied leading "1"
  476.       bra    1f
  477. ***************
  478. *** 89,95 ****
  479.       beq    retz        | dividing zero
  480.   # endif    ERROR_CHECK
  481.   
  482. -     andl    #0x7fffff,d5    | remove exponent from v.mantissa
  483.       tstw    d1        | check for zero exponent - no leading "1"
  484.       beq    0f
  485.       orl    #0x800000,d5    | restore implied leading "1"
  486. --- 155,160 ----
  487. ===================================================================
  488. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_extends.cpp,v
  489. retrieving revision 1.2
  490. diff -c -r1.2 _extends.cpp
  491. *** 1.2    1992/10/09 20:35:29
  492. --- _extends.cpp    1993/01/13 14:30:40
  493. ***************
  494. *** 35,43 ****
  495.       movew    d0,d2        | extract sign
  496.       lsrw    #7,d0
  497.       andw    #0xff,d0    | kill sign bit (exponent is 8 bits)
  498.       andl    #0x7fffff,d4    | remove exponent from mantissa
  499. !     tstw    d0        | check for zero exponent - no leading "1"
  500.       beq    0f        | for denormalized numbers
  501.       orl    #0x800000,d4    | restore implied leading "1"
  502.       bra    1f
  503. --- 35,60 ----
  504.       movew    d0,d2        | extract sign
  505.       lsrw    #7,d0
  506.       andw    #0xff,d0    | kill sign bit (exponent is 8 bits)
  507.       andl    #0x7fffff,d4    | remove exponent from mantissa
  508. !     cmpb    #0xff,d0
  509. !     bne    nospec
  510. !     tstl    d4
  511. !     beq    retinf
  512. ! | ret nan
  513. !     movel    #0x7fffffff,d0
  514. !     moveql    #-1,d1
  515. ! return:    moveml    sp@+,d2-d7
  516. !     rts
  517. ! retinf:    clrl    d1
  518. !     movel    #0x7ff00000,d0
  519. !     tstw    d2
  520. !     bpl    return
  521. !     bset    #31,d0
  522. !     bra    return
  523. !     
  524. ! nospec:    tstw    d0        | check for zero exponent - no leading "1"
  525.       beq    0f        | for denormalized numbers
  526.       orl    #0x800000,d4    | restore implied leading "1"
  527.       bra    1f
  528. ===================================================================
  529. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_mulsf3.cpp,v
  530. retrieving revision 1.2
  531. diff -c -r1.2 _mulsf3.cpp
  532. *** 1.2    1992/10/09 20:35:29
  533. --- _mulsf3.cpp    1993/01/13 14:30:42
  534. ***************
  535. *** 45,51 ****
  536. --- 45,55 ----
  537.   |
  538.   | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
  539.   | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
  540. + | patched by Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de)
  541.   |
  542. + | Revision 1.2.1 olaf 12-92:
  543. + |   + added support for NaN and Infinites
  544. + |   + added support for -0
  545.   |
  546.   | Revision 1.2, kub 01-90 :
  547.   | added support for denormalized numbers
  548. ***************
  549. *** 62,69 ****
  550.       lea    sp@(4),a0
  551.       moveml    d2-d5,sp@-
  552.       moveml    a0@,d4/d5    | d4 = v, d5 = u
  553. -     subw    #8,sp        | multiplication accumulator
  554.   
  555.       movel    d5,d0        | d0 = u.exp
  556.       swap    d0
  557.       movew    d0,d2        | d2 = u.sign
  558. --- 66,73 ----
  559.       lea    sp@(4),a0
  560.       moveml    d2-d5,sp@-
  561.       moveml    a0@,d4/d5    | d4 = v, d5 = u
  562.   
  563.       movel    d5,d0        | d0 = u.exp
  564.       swap    d0
  565.       movew    d0,d2        | d2 = u.sign
  566. ***************
  567. *** 77,82 ****
  568. --- 81,131 ----
  569.       andw    #0xff,d1    | kill sign bit
  570.   
  571.       andl    #0x7fffff,d5    | remove exponent from u.mantissa
  572. +     andl    #0x7fffff,d4    | remove exponent from v.mantissa
  573. + |
  574. + | Testing for NaN and Infinities
  575. + |
  576. +     cmpb    #0xff,d0
  577. +     beq    0f
  578. +     cmpb    #0xff,d1
  579. +     bne    nospec
  580. +     bra    1f
  581. + |    first operand is special
  582. + |    Nan?
  583. + 0:    tstl    d5
  584. +     bne    retnan
  585. + |    Test v==0.
  586. +     tstb    d1
  587. +     bne    retinf  |  Inf  * x == Inf
  588. +     tstl    d4
  589. +     beq    retnan  | Inf * 0 == NaN
  590. + retinf:    tstl    d2
  591. +     bpl    0f
  592. +     movel    #0xff800000,d0
  593. + return:    moveml    sp@+,d2-d5
  594. +     rts
  595. + 0:    movel    #0x7f800000,d0
  596. +     bra    return    
  597. + retnan: movel    #0x7fffffff,d0
  598. +     bra    return
  599. + |
  600. + | v is special
  601. + |
  602. + 1:    tstl    d4
  603. +     bne    retnan
  604. +     tstb    d0
  605. +     bne    retinf
  606. +     tstl    d5
  607. +     beq    retnan
  608. +     bra    retinf
  609. + |
  610. + | end of NaN and Inf.
  611. + |    
  612. + nospec:    subw    #8,sp        | multiplication accumulator
  613.       tstw    d0        | check for zero exponent - no leading "1"
  614.       beq    0f
  615.       orl    #0x800000,d5    | restore implied leading "1"
  616. ***************
  617. *** 85,91 ****
  618.   1:    tstl    d5
  619.       beq    retz        | multiplying zero
  620.   
  621. -     andl    #0x7fffff,d4    | remove exponent from v.mantissa
  622.       tstw    d1        | check for zero exponent - no leading "1"
  623.       beq    0f
  624.       orl    #0x800000,d4    | restore implied leading "1"
  625. --- 134,139 ----
  626. ===================================================================
  627. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_negsf2.s,v
  628. retrieving revision 1.2
  629. diff -c -r1.2 _negsf2.s
  630. *** 1.2    1992/10/09 20:35:29
  631. --- _negsf2.s    1993/01/13 14:30:45
  632. ***************
  633. *** 2,8 ****
  634. --- 2,12 ----
  635.   |
  636.   | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
  637.   | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
  638. + | patched by Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de)
  639.   |
  640. + | revision 1.1.1, olaf 12-92
  641. + |  + Since sign of NaN is ignored, we can flip it.
  642. + |  + -0. is different from 0., but compares equal!
  643.   |
  644.   | Revision 1.1, kub 12-89 :
  645.   | Created single float version for 68000
  646. ***************
  647. *** 16,22 ****
  648.   
  649.   __negsf2:            | floating point negate
  650.   ___negsf2:
  651. !     movel    sp@(4),d0    | do not negate if operand is 0.0
  652. !     beq    0f
  653.       bchg    #31,d0        | flip sign bit
  654. ! 0:    rts
  655. --- 20,25 ----
  656.   
  657.   __negsf2:            | floating point negate
  658.   ___negsf2:
  659. !     movel    sp@(4),d0
  660.       bchg    #31,d0        | flip sign bit
  661. !     rts
  662. ===================================================================
  663. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_normsf.cpp,v
  664. retrieving revision 1.4
  665. diff -c -r1.4 _normsf.cpp
  666. *** 1.4    1992/12/18 16:35:41
  667. --- _normsf.cpp    1993/01/13 14:30:49
  668. ***************
  669. *** 9,14 ****
  670. --- 9,17 ----
  671.   | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
  672.   | patched by Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de)
  673.   |
  674. + | Revision 1.4.3 olaf 12-92:
  675. + |  + added support for -0.
  676. + |
  677.   | Revision 1.4.2 olaf 11-92
  678.   |  + correct stack after overflow.
  679.   |
  680. ***************
  681. *** 130,136 ****
  682.   retz:    moveq    #ERANGE,d0
  683.       Emove    d0,Errno
  684.       clrl    d0
  685. !     moveml    sp@+,d2-d5
  686.       rts
  687.   
  688.   oflow:    
  689. --- 133,142 ----
  690.   retz:    moveq    #ERANGE,d0
  691.       Emove    d0,Errno
  692.       clrl    d0
  693. !     tstw    d2
  694. !     bpl    0f        | -0
  695. !     bset    #31,d0
  696. ! 0:    moveml    sp@+,d2-d5
  697.       rts
  698.   
  699.   oflow:    
  700. ===================================================================
  701. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/access.c,v
  702. retrieving revision 1.9
  703. diff -c -r1.9 access.c
  704. *** 1.9    1992/09/14 14:56:40
  705. --- access.c    1993/02/22 06:15:11
  706. ***************
  707. *** 20,29 ****
  708.       if (mode == F_OK)
  709.           return 0;    /* existence test succeeded */
  710.   
  711.   /* somewhat crufty code -- relies on R_OK, etc. matching the bits in the
  712.      file mode, but what the heck, we can do this
  713.    */
  714. !     if (__mint < 9 || ( geteuid() == sb.st_uid ) ) {
  715.           if ( ((sb.st_mode >> 6) & mode) == mode )
  716.               return 0;
  717.           else
  718. --- 20,31 ----
  719.       if (mode == F_OK)
  720.           return 0;    /* existence test succeeded */
  721.   
  722. +     if (getuid() == 0) return 0; /* super user can access anything */
  723.   /* somewhat crufty code -- relies on R_OK, etc. matching the bits in the
  724.      file mode, but what the heck, we can do this
  725.    */
  726. !     if (__mint < 9 || ( getuid() == sb.st_uid ) ) {
  727.           if ( ((sb.st_mode >> 6) & mode) == mode )
  728.               return 0;
  729.           else
  730. ***************
  731. *** 30,36 ****
  732.               goto accdn;
  733.       }
  734.   
  735. !     if ( getegid() == sb.st_gid ) {
  736.           if ( ((sb.st_mode >> 3) & mode) == mode )
  737.               return 0;
  738.           else
  739. --- 32,38 ----
  740.               goto accdn;
  741.       }
  742.   
  743. !     if ( getgid() == sb.st_gid ) {
  744.           if ( ((sb.st_mode >> 3) & mode) == mode )
  745.               return 0;
  746.           else
  747. ===================================================================
  748. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/alloca.cpp,v
  749. retrieving revision 1.7
  750. diff -c -r1.7 alloca.cpp
  751. *** 1.7    1992/10/09 20:35:29
  752. --- alloca.cpp    1993/02/18 00:00:06
  753. ***************
  754. *** 1,9 ****
  755. ! #APP
  756. ! # 
  757. ! #  alloca(nbytes) allocate junk in stack frame
  758. ! #
  759. ! #  void *alloca(size_t size)
  760. ! # 
  761.   
  762.       .text
  763.        .even
  764. --- 1,8 ----
  765. ! | 
  766. ! |  alloca(nbytes) allocate junk in stack frame
  767. ! |
  768. ! |  void *alloca(size_t size)
  769. ! | 
  770.   
  771.       .text
  772.        .even
  773. ***************
  774. *** 11,17 ****
  775. --- 10,21 ----
  776.   .globl    _alloca
  777.   _alloca:
  778.       movel    sp@+,a0        | get return addr
  779. + #ifndef __SOZOBON__
  780.       movel    sp@+,d0        | get size -- assist in bug fix, add 4 to sp
  781. + #else
  782. +     clrl    d0        | this size_t thing is getting to be
  783. +     movew    sp@+,d0        |  an annoyance...  -- sb
  784. + #endif
  785.   
  786.       addql    #1,d0        | ensure address even
  787.       bclr    #0,d0        | lop off odd bit
  788. ***************
  789. *** 19,24 ****
  790. --- 23,32 ----
  791.       subl    d0,sp        | increase stack frame size by that much
  792.       movel    sp,d0        | set up to return it
  793.   
  794. + #ifndef __SOZOBON__
  795.       lea    sp@(-4),sp    | new top of stack (real bug fix here)
  796. + #else
  797. +     lea    sp@(-2),sp    | hope this is correct...  -- sb
  798. + #endif
  799.   
  800.       jmp    a0@        | return by jmping via saved addr
  801. ===================================================================
  802. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/atof.c,v
  803. retrieving revision 1.23
  804. diff -c -r1.23 atof.c
  805. *** 1.23    1992/10/09 20:35:29
  806. --- atof.c    1993/01/13 14:30:52
  807. ***************
  808. *** 29,34 ****
  809. --- 29,37 ----
  810.    *    thanks peter!
  811.    *
  812.    *    mjr: 68881 version added
  813. +  *
  814. +  *    schwab: 68881 version replaced with new implementation that
  815. +  *        uses fmovep for maximum precision, no bits lost anymore!
  816.    */
  817.   
  818.   #if !defined (__M68881__) && !defined (sfp004)
  819. ***************
  820. *** 451,728 ****
  821.   }
  822.   #endif /* __OLD__ */
  823.   
  824. ! #else    __M68881__ || sfp004
  825. ! #if 0
  826. ! #ifndef    sfp004
  827. ! # define _M68881    /* use the predefined inline functions                */
  828. ! #endif    sfp004
  829. ! #endif 0
  830. ! /* M.R's kludgy atof --- 881 version.                        */
  831. ! /*     uses long integer accumulators and extended precision to put them    */
  832. ! /*    together in the fpu. The conversion long to extended is done completely    */
  833. ! /*    on the 881.                                */
  834. ! /*    using extended precision in _float_ avoids rounding errors.        */
  835. ! /* 12.7.1989, 11.10.90, 28.1.91, 24.11.91                    */
  836. ! /* On overflow, only +-infinity is returned (the 68881's default).        */
  837. ! /* 24.11.91: return +-MAXDOUBLE instead of +- INFINITY or NAN            */
  838. ! /*           set errno to ERANGE/EDOM                        */
  839. ! # include <ctype.h>
  840. ! # include <stdio.h>
  841. ! # include <float.h>
  842. ! # include <math.h>
  843. ! # include <errno.h>
  844. ! # include "flonum.h"
  845. ! double atof( const char * );
  846. ! double strtod( const char *, const char ** );
  847. ! double _Float_( long, long, long, long );
  848. ! # define    true 1
  849. ! # define false 0
  850. ! # define CharIsDigit ( isdigit(*Text) )
  851. ! # define Digit ((*Text-'0'))
  852. ! #if 0
  853. ! static unsigned long
  854. !     __notanumber[2] = { 0x7fffffffL, 0xffffffffL }; /* ieee NAN */
  855. ! # define NAN  (*((double *)&__notanumber[0]))
  856. ! # endif 0
  857. ! # define ten_mul(X)    ((((X) << 2) + (X)) << 1)
  858.   
  859. ! double strtod( const char * Save, const char ** Endptr )
  860. ! {
  861. !   register int Count; int Negative = false, ExpNegative = false;
  862.   
  863. !   double Value;
  864. !   union double_di * l_Value;
  865. !   register long Exponent, Exp_Temp;
  866. !   register long Value_1, Value_2;
  867. !   register char c;
  868. !   register char * Text;
  869. !   register char * Places;
  870. !   char Buffer[15];
  871. !   l_Value = (union double_di *) &Value;
  872. !   Text = Save;
  873. !   Places = Buffer;
  874. !   /* skip over leading whitespace */
  875. !   while (isspace(*Text)) Text++;
  876. !   if (*Text == '-') {
  877. !     Negative = true;
  878. !     Text++;
  879. !   } else
  880. !   if (*Text == '+') {
  881. !     Negative = false;
  882. !     Text++;
  883. !   } else
  884. !   if( *Text == 0 ) {
  885. !     if( Endptr != NULL ) *Endptr = Text;
  886. !     return 0.0;
  887. !   }
  888. !   /* Process the 'f'-part                             */
  889. !   /* ignore any digit beyond the 15th                         */
  890. !   /* BUG: may overflow if more than 10 digits precede the '.'            */
  891. !   /* to cure use to accumulators as is being done for the digits after        */
  892. !   /* the '.'.                                    */
  893. !   Exp_Temp = 0;            /* needed later on for the exponential part    */
  894. !   Value_1 = 0; Value_2 = 0; Count = 0; Exponent = 0;
  895. !   while( CharIsDigit ) {    /* process digits before '.'            */
  896. !     if( Count < 15 ) {
  897. !       Count++;
  898. !       *Places++ = Digit;
  899. !     }
  900. !     Text++;
  901. !   }
  902. !   if ( *Text == '.') {
  903. !     Text++;
  904. !     while( CharIsDigit ) {    /* process digits after '.'            */
  905. !       if( Count < 15 )    {
  906. !         Count++;
  907. !             *Places++ = Digit;
  908. !         Exponent--;
  909. !       }
  910. !       Text++;
  911. !     }
  912. !   }
  913. !   Places = Buffer;
  914. !   /* Now, Places points to a vector of <= 15 digits                */
  915. !   /* text points to the position immediately after the end of the mantissa    */
  916. !   /* Value_2 will contain the equiv. of the 8 least significant digits, while    */
  917. !   /* Value_1 will contain the equiv. of the 7 most significant digits (if any)    */
  918. !   /* and therefore has to be multiplied by 10^8                    */
  919. !   /* no overflow possible in the temporary buffers                */
  920. !   while( Count > 8 )    {
  921. !       Value_1 = ten_mul( Value_1 );      Value_1 += *Places++;
  922. !       Count--;
  923. !   }
  924. !   while( Count > 0 )    {
  925. !       Value_2 = ten_mul( Value_2 );      Value_2 += *Places++;
  926. !       Count--;
  927. !   }
  928. !   /* 'e'-Part */
  929. !   if ( *Text == 'e' || *Text == 'E' || *Text == 'd' || *Text == 'D' ) {
  930. !     char * Tail = Text;
  931. !     Text++;
  932. !     /* skip over whitespace since ANSI allows space after e|E|d|D        */
  933. !     while (isspace(*Text)) Text++;
  934. !     if ( * Text == '-' ) {
  935. !         ExpNegative = true;
  936. !         Text++;
  937. !     } else
  938. !     if( * Text == '+' ) {
  939. !         ExpNegative = false;
  940. !         Text++;
  941. !     }
  942. !     if( !CharIsDigit ) {
  943. !         *Endptr = Tail;    /* take the 'e|E|d|D' as part of the characters    */
  944. !         goto Ende;        /* following the number            */
  945. !     } else {
  946. !     /* Exponents may have at most 3 digits, everything beyond this will be    */
  947. !     /* silently ignored                            */
  948. !         Count = 0;
  949. !         while( CharIsDigit && (Count < 3) ) {
  950. !             Exp_Temp = ten_mul( Exp_Temp ); Exp_Temp += Digit;
  951. !               Count++;
  952. !             Text++;
  953. !         }
  954. !         if( ExpNegative ) Exp_Temp = -Exp_Temp;
  955. !         Exponent += Exp_Temp;
  956. !      }
  957. !   }
  958. !   Value = _Float_( Value_1, Exponent+8L, Value_2, Exponent );
  959. !   if( Endptr != NULL ) *Endptr = Text;
  960. !   if( (l_Value -> i[0]) >= 0x7ff00000U )    { /* INFINITY or NAN        */
  961. !     fprintf(stderr," strtod: OVERFLOW error\n");
  962. !     errno = ERANGE;
  963. !     Value = DBL_MAX;
  964. !   }
  965.   
  966. ! Ende:    
  967. !   if( Negative ) {
  968. !     Value = -Value;
  969. !   }
  970. !   return( Value );
  971. ! # if 0
  972. ! Error:
  973. !   fputs("\njunk number \"",stderr); fputs(Save,stderr); 
  974. !   fputs("\" --- returning NAN\n",stderr);
  975. !   errno = ERANGE;
  976. !   if( Endptr != NULL ) *Endptr = Text;
  977. !   return(NAN);    /* == Not A Number (NAN) */
  978. ! # endif
  979. ! }
  980.   
  981. ! double atof( const char * Text )
  982. ! {
  983. !     return(strtod(Text,(char **)NULL));
  984. ! }
  985.   
  986. ! /*
  987. !  * double _Float_( long Value_1, long Exponent_1, long Value_2, long Exponent_2 )
  988. !  *
  989. !  * merges the accumulators Value_1, Value_2 and the Exponent to a double
  990. !  * precision float
  991. !  * called by strtod()
  992. !  *
  993. !  * does all floating point computations with extended precision on the fpu
  994. !  */
  995.   
  996. ! #endif __M68881__ || sfp004
  997.   
  998. ! #ifdef __M68881__
  999. ! asm(
  1000. ! ".even
  1001. ! .text
  1002. !     .globl __Float_
  1003. ! __Float_:
  1004. !     ftentoxl    a7@(8),fp1        | load Exponent_1
  1005. !     ftentoxl    a7@(16),fp0        | load Exponent_2
  1006. !     fmull        a7@(12),fp0        | fmull Value_2 -> fp0
  1007. !     fmull        a7@(4),fp1        | fmull Value_1 -> fp1
  1008. !     faddx        fp0,fp1
  1009. !     fmoved        fp1,a7@-        | fmoved fp1 -> d0/d1
  1010. !     moveml        a7@+,d0-d1
  1011. !      rts
  1012. ! ");
  1013. ! #endif    __M68881
  1014. ! #ifdef    sfp004
  1015.   
  1016. ! asm("| mjr, 30.1.1991
  1017. ! |
  1018. ! | base =    0xfffa50
  1019. ! |      the fpu addresses are taken relativ to 'base':
  1020. ! |
  1021. ! | a0: fpu base address
  1022. ! |
  1023. ! | waiting loop ...
  1024. ! |
  1025. ! | wait:
  1026. ! | ww:    cmpiw    #0x8900,a0@(resp)
  1027. ! |     beq    ww
  1028. ! | is coded directly by
  1029. ! |    .long    0x0c688900, 0xfff067f8 (a0)
  1030. ! | and
  1031. ! | www:    tst.w    a0@(resp)
  1032. ! |    bmi.b    www
  1033. ! | is coded by
  1034. ! |    .word    0x4a68,0xfff0,0x6bfa        | test
  1035. ! |
  1036. ! comm =     -6
  1037. ! resp =    -16
  1038. ! zahl =      0
  1039.   
  1040. !     .globl __Float_
  1041. ! .even
  1042. ! .text
  1043. ! __Float_:
  1044. !     lea    0xfffffa50:w,a0            | fpu address
  1045.   
  1046. !     movew    #0x4092,a0@(comm)        | ftentoxl -> fp1
  1047. !     .long    0x0c688900, 0xfff067f8
  1048. !     movel    a7@(8),a0@            | load Exponent_1
  1049. !     movew    #0x4112,a0@(comm)        | ftentoxl -> fp2
  1050. !     .long    0x0c688900, 0xfff067f8
  1051. !     movel    a7@(16),a0@            | load Exponent_2
  1052. !     movew    #0x4123,a0@(comm)        | fmull Value_2 -> fp2
  1053. !     .long    0x0c688900, 0xfff067f8
  1054. !     movel    a7@(12),a0@            | load Value_2
  1055. !     movew    #0x40a3,a0@(comm)        | fmull Value_1 -> fp1
  1056. !     .long    0x0c688900, 0xfff067f8
  1057. !     movel    a7@(4),a0@            | load Value_1
  1058.   
  1059. !     movew    #0x08a2,a0@(comm)        | faddx fp2 -> fp1
  1060. !     .word    0x4a68,0xfff0,0x6bfa        | test
  1061.   
  1062. !     movew    #0x7480,a0@(comm)        | fmoved fp1 -> d0/d1
  1063. !     .long    0x0c688900, 0xfff067f8
  1064. !     movel    a0@,d0
  1065. !     movel    a0@,d1
  1066. !      rts
  1067. ! ");
  1068. ! #endif    sfp004
  1069.   
  1070.   #ifdef TEST
  1071.   #if 0
  1072. --- 454,670 ----
  1073.   }
  1074.   #endif /* __OLD__ */
  1075.   
  1076. ! #else /* __M68881__ || sfp004 */
  1077.   
  1078. ! #include <string.h>
  1079. ! #include <ctype.h>
  1080. ! #include <math.h>
  1081. ! #include <float.h>
  1082. ! #include <errno.h>
  1083. ! #include "flonum.h"
  1084.   
  1085. ! #ifdef sfp004
  1086. ! /* Note: not tested -- schwab */
  1087.   
  1088. ! /* static */ double Float __PROTO ((char *));
  1089.   
  1090. ! asm ("
  1091. ! comm = -6;
  1092. ! resp = -16;
  1093. ! .text
  1094. ! .even
  1095. ! _Float:
  1096. !     lea    0xfffffa50:w,a0            | fpu address
  1097. !     movel    sp@(4),a1
  1098. !     movew    #0x4c00,a0@(comm)        | fmovep -> fp0
  1099. ! 1:    cmpw    #0x8900,a0@(resp)
  1100. !     beq    1b
  1101. !     movel    a1@+,a0@            | load data
  1102. !     movel    a1@+,a0@
  1103. !     movel    a1@+,a0@
  1104. !     movew    #0x7400,a0@(comm)        | fmoved fp0 -> d0/d1
  1105. ! 1:    cmpw    #0x8900,a0@(resp)
  1106. !     beq    1b
  1107. !     movel    a0@,d0
  1108. !     movel    a0@,d1
  1109. !     rts
  1110. ! ");
  1111. ! #endif
  1112.   
  1113. ! /* Format of packed decimal (from left to right):
  1114.   
  1115. !     1 Bit: sign of mantissa
  1116. !     1 Bit: sign of exponent
  1117. !     2 Bits zero
  1118. !    12 Bits: three digits exponent
  1119. !     4 Bits unused, fourth (higher order) digit of exponent
  1120. !     8 Bits zero
  1121. !    68 Bits: 17 digits of mantissa, decimal point after first digit
  1122. !   --------
  1123. !    96 Bits == 12 Bytes
  1124.   
  1125. !    All digits in BCD format.  */
  1126.   
  1127. ! double
  1128. ! strtod (const char *str, const char **endptr)
  1129. ! {
  1130. !   char packed_buf[12];
  1131. !   char *p;
  1132. !   int exponent, i, digits_seen;
  1133. !   union double_di di;
  1134. !   if (endptr)
  1135. !     *endptr = str;
  1136. !   while (isspace (*str))
  1137. !     str++;
  1138. !   p = packed_buf;
  1139. !   for (i = 0; i < sizeof (packed_buf); i++)
  1140. !     *p++ = 0;
  1141. !   if (*str == '-')
  1142. !     {
  1143. !       packed_buf[0] = 0x80;
  1144. !       str++;
  1145. !     }
  1146. !   else if (*str == '+')
  1147. !     str++;
  1148. !   else if (*str == '\0')
  1149. !     return 0.0;
  1150. !   i = 0;
  1151. !   exponent = -1;
  1152. !   digits_seen = 0;
  1153. !   p = packed_buf + 3;
  1154. !   /* Ignore leading 0's. */
  1155. !   while (*str == '0')
  1156. !     {
  1157. !       digits_seen++;
  1158. !       str++;
  1159. !     }
  1160. !   while (isdigit (*str))
  1161. !     {
  1162. !       digits_seen++;
  1163. !       if (i < 17)
  1164. !     {
  1165. !       if (i & 1)
  1166. !         *p = (*str - '0') << 4;
  1167. !       else
  1168. !         *p++ |= *str - '0';
  1169. !       i++;
  1170. !     }
  1171. !       exponent++;
  1172. !       str++;
  1173. !     }
  1174. !   if (*str == '.')
  1175. !     {
  1176. !       str++;
  1177. !       if (i == 0)
  1178. !     {
  1179. !       /* Skip leading 0's.  */
  1180. !       while (*str == '0')
  1181. !         {
  1182. !           digits_seen++;
  1183. !           exponent--;
  1184. !           str++;
  1185. !         }
  1186. !     }
  1187. !       while (isdigit (*str))
  1188. !     {
  1189. !       digits_seen++;
  1190. !       if (i < 17)
  1191. !         {
  1192. !           if (i++ & 1)
  1193. !         *++p = (*str - '0') << 4;
  1194. !           else
  1195. !         *p |= *str - '0';
  1196. !         }
  1197. !       str++;
  1198. !     }
  1199. !     }
  1200. !   /* Check that there were any digits.  */
  1201. !   if (!digits_seen)
  1202. !     return 0.0;
  1203.   
  1204. !   if (*str == 'e' || *str == 'E' || *str == 'd' || *str == 'D')
  1205. !     {
  1206. !       const char *eptr = str;
  1207. !       int exp_given, exp_neg;
  1208.   
  1209. !       str++;
  1210. !       while (isspace (*str))
  1211. !     str++;
  1212. !       exp_neg = 0;
  1213. !       if (*str == '-')
  1214. !     {
  1215. !       exp_neg = 1;
  1216. !       str++;
  1217. !     }
  1218. !       else if (*str == '+')
  1219. !     str++;
  1220. !       if (!isdigit (*str))
  1221. !     {
  1222. !       str = eptr;
  1223. !       goto convert;
  1224. !     }
  1225. !       while (*str == '0')
  1226. !     str++;
  1227. !       exp_given = 0;
  1228. !       while (isdigit (*str) && exp_given < 900)
  1229. !     {
  1230. !       exp_given = exp_given * 10 + *str - '0';
  1231. !       str++;
  1232. !     }
  1233. !       while (isdigit (*str))
  1234. !     str++;
  1235. !       if (exp_given >= 900)
  1236. !     {
  1237. !       /* Must be overflow/underflow.  */
  1238. !       if (endptr)
  1239. !         *endptr = str;
  1240. !       if (exp_neg)
  1241. !         return 0.0;
  1242. !       goto overflow;
  1243. !     }
  1244. !       if (exp_neg)
  1245. !     exponent -= exp_given;
  1246. !       else
  1247. !     exponent += exp_given;
  1248. !     }
  1249. !  convert:
  1250. !   if (endptr)
  1251. !     *endptr = str;
  1252. !   if (exponent < 0)
  1253. !     {
  1254. !       packed_buf[0] |= 0x40;
  1255. !       exponent = -exponent;
  1256. !     }
  1257. !   packed_buf[1] = exponent % 10;
  1258. !   packed_buf[1] |= ((exponent /= 10) % 10) << 4;
  1259. !   packed_buf[0] |= exponent / 10 % 10;
  1260. ! #ifdef sfp004
  1261. !   di.d = Float (packed_buf);
  1262. ! #else
  1263. !   __asm ("fmovep %1,%0" : "=f" (di.d) : "m" (packed_buf[0]));
  1264. ! #endif
  1265. !   /* Check for overflow.  */
  1266. !   if ((di.i[0] & 0x7fffffff) >= 0x7ff00000)
  1267. !     {
  1268. !     overflow:
  1269. !       errno = ERANGE;
  1270. !       if (packed_buf[0] & 0x80)
  1271. !     return -DBL_MAX;
  1272. !       else
  1273. !     return DBL_MAX;
  1274. !     }
  1275. !   return di.d;
  1276. ! }
  1277.   
  1278. ! double
  1279. ! atof (const char *str)
  1280. ! {
  1281. !   return strtod (str, NULL);
  1282. ! }
  1283.   
  1284. ! #endif /* __M68881__ || sfp004 */
  1285.   
  1286.   #ifdef TEST
  1287.   #if 0
  1288. ===================================================================
  1289. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/bcopy.cpp,v
  1290. retrieving revision 1.7
  1291. diff -c -r1.7 bcopy.cpp
  1292. *** 1.7    1992/11/06 23:02:09
  1293. --- bcopy.cpp    1993/02/18 00:00:08
  1294. ***************
  1295. *** 17,38 ****
  1296.   |    returns dest
  1297.   |    functions are aliased
  1298.   
  1299.   _memcpy:
  1300.   _memmove:
  1301.       movl    sp@(4),a1    | dest
  1302.       movl    sp@(8),a0    | src
  1303.       jra    common        | the rest is samea as bcopy
  1304.   
  1305.   |    void bcopy( const void *src, void *dest, size_t length );
  1306. ! |    void lbcopy( const void *src, void *dest, size_t length );
  1307.   |    return value not used (returns src)
  1308. ! |    functions are aliased
  1309.   
  1310.   _bcopy:
  1311.   __bcopy:
  1312.       movl    sp@(4),a0    | src
  1313.       movl    sp@(8),a1    | dest
  1314.   common:    movl    sp@(12),d0    | length
  1315.       jeq    exit        | length==0? (size_t)
  1316.   
  1317.                   | a0 src, a1 dest, d0.l length
  1318. --- 17,61 ----
  1319.   |    returns dest
  1320.   |    functions are aliased
  1321.   
  1322. + #ifndef __SOZOBON__
  1323.   _memcpy:
  1324.   _memmove:
  1325.       movl    sp@(4),a1    | dest
  1326.       movl    sp@(8),a0    | src
  1327.       jra    common        | the rest is samea as bcopy
  1328. + #else
  1329. + |    _bcopy() is the base function below; for memcpy(), memmove()
  1330. + |    and bcopy(), we have to sneak a size_t into an unsigned long first.
  1331.   
  1332. + _memcpy:
  1333. + _memmove:
  1334. +     movl    sp@(4),a1    | dest
  1335. +     movl    sp@(8),a0    | src
  1336. +     clrl    d0        | here is the sneaky bit...
  1337. +     movw    sp@(12),d0    | length
  1338. +     jra    common2        | the rest is samea as bcopy
  1339. + _bcopy:
  1340. +     movl    sp@(4),a0    | src
  1341. +     movl    sp@(8),a1    | dest
  1342. +     clrl    d0        | here is the sneaky bit...
  1343. +     movw    sp@(12),d0    | length
  1344. +     jra    common2        | the rest is samea as bcopy
  1345. + #endif
  1346.   |    void bcopy( const void *src, void *dest, size_t length );
  1347. ! |    void _bcopy( const void *src, void *dest, unsigned long length );
  1348.   |    return value not used (returns src)
  1349. ! |    functions are aliased (except for HSC -- sb)
  1350.   
  1351. + #ifndef __SOZOBON__
  1352.   _bcopy:
  1353. + #endif
  1354.   __bcopy:
  1355.       movl    sp@(4),a0    | src
  1356.       movl    sp@(8),a1    | dest
  1357.   common:    movl    sp@(12),d0    | length
  1358. + common2:
  1359.       jeq    exit        | length==0? (size_t)
  1360.   
  1361.                   | a0 src, a1 dest, d0.l length
  1362. ===================================================================
  1363. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/bzero.cpp,v
  1364. retrieving revision 1.3
  1365. diff -c -r1.3 bzero.cpp
  1366. *** 1.3    1992/11/06 23:02:09
  1367. --- bzero.cpp    1993/02/18 00:00:10
  1368. ***************
  1369. *** 18,24 ****
  1370. --- 18,29 ----
  1371.       movl    sp@(4),a0    | dest
  1372.   #ifdef __MSHORT__
  1373.       movb    sp@(9),d0    | value
  1374. + # ifndef __SOZOBON__
  1375.       movl    sp@(10),d1    | length
  1376. + # else
  1377. +     clrl    d1
  1378. +     movw    sp@(10),d1    | length
  1379. + # endif
  1380.   #else
  1381.       movb    sp@(11),d0    | value
  1382.       movl    sp@(12),d1    | length
  1383. ***************
  1384. *** 27,39 ****
  1385.       jra    do_set
  1386.   
  1387.   |    void bzero( void *dest, size_t length );
  1388. ! |    void _bzero( void *dest, size_t length );
  1389.   |    return value not used (returns dest)
  1390.   
  1391.   _bzero:
  1392.   __bzero:
  1393.       movl    sp@(4),a0    | dest
  1394.       movl    sp@(8),d1    | length
  1395.       jeq    exit        | length==0? (size_t)
  1396.       clrb    d0        | value
  1397.   
  1398. --- 32,53 ----
  1399.       jra    do_set
  1400.   
  1401.   |    void bzero( void *dest, size_t length );
  1402. ! |    void _bzero( void *dest, unsigned long length );
  1403.   |    return value not used (returns dest)
  1404.   
  1405. + #ifdef __SOZOBON__
  1406.   _bzero:
  1407. +     movl    sp@(4),a0    | dest
  1408. +     clrl    d1
  1409. +     movw    sp@(8),d1    | length
  1410. +     jra    scommon
  1411. + #else
  1412. + _bzero:
  1413. + #endif
  1414.   __bzero:
  1415.       movl    sp@(4),a0    | dest
  1416.       movl    sp@(8),d1    | length
  1417. + scommon:
  1418.       jeq    exit        | length==0? (size_t)
  1419.       clrb    d0        | value
  1420.   
  1421. ***************
  1422. *** 44,53 ****
  1423.   
  1424.       movw    a0,d2        | test for alignment
  1425.       btst    #0,d2        | odd ?
  1426. !     jeq    even
  1427.       movb    d0,a0@-     | set one byte, now we are even
  1428.       subql    #1,d1
  1429. ! even:
  1430.       movb    d0,d2
  1431.       lslw    #8,d0
  1432.       movb    d2,d0
  1433. --- 58,67 ----
  1434.   
  1435.       movw    a0,d2        | test for alignment
  1436.       btst    #0,d2        | odd ?
  1437. !     jeq    areeven
  1438.       movb    d0,a0@-     | set one byte, now we are even
  1439.       subql    #1,d1
  1440. ! areeven:
  1441.       movb    d0,d2
  1442.       lslw    #8,d0
  1443.       movb    d2,d0
  1444. ===================================================================
  1445. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/ctime.c,v
  1446. retrieving revision 1.8
  1447. diff -c -r1.8 ctime.c
  1448. *** 1.8    1992/09/14 14:56:40
  1449. --- ctime.c    1993/02/18 00:00:15
  1450. ***************
  1451. *** 37,44 ****
  1452.   
  1453.   #else
  1454.   
  1455.   static char *
  1456. ! two_dig(char *buf, unsigned short num) {
  1457.       unsigned int rem;
  1458.   
  1459.       rem = num % 10;
  1460. --- 37,49 ----
  1461.   
  1462.   #else
  1463.   
  1464. + static char * two_dig __PROTO((char *buf, unsigned short num));
  1465.   static char *
  1466. ! two_dig(buf, num)
  1467. !     char *buf;
  1468. !     unsigned short num;
  1469. ! {
  1470.       unsigned int rem;
  1471.   
  1472.       rem = num % 10;
  1473. ===================================================================
  1474. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/doprnt.c,v
  1475. retrieving revision 1.19
  1476. diff -c -r1.19 doprnt.c
  1477. *** 1.19    1992/11/08 00:02:47
  1478. --- doprnt.c    1993/02/18 00:00:18
  1479. ***************
  1480. *** 22,27 ****
  1481. --- 22,30 ----
  1482.    *      mjr++
  1483.    * and for turbo C and the MiNT library
  1484.    *     ++um,mh
  1485. +  * and special M68881 and sfp004 version of cvt() added that uses fmovep for
  1486. +  * maximum precision, no bits lost anymore!
  1487. +  *    ++schwab
  1488.    */
  1489.   
  1490.   #ifndef __NO_FLOAT__
  1491. ***************
  1492. *** 82,92 ****
  1493.   
  1494.   #define    PUTC(ch)     if( fputc(ch, fp) == EOF ) return EOF;
  1495.   
  1496. - #define ARG(basetype) \
  1497. -     _ulong = flags&LONGINT ? va_arg(argp, long basetype) : \
  1498. -         flags&SHORTINT ? (short basetype)va_arg(argp, short) : \
  1499. -         va_arg(argp, int)
  1500.   
  1501.   #define TEN_MUL(X)    ((((X) << 2) + (X)) << 1)
  1502.   
  1503.   #define    todigit(c)    ((c) - '0')
  1504. --- 85,102 ----
  1505.   
  1506.   #define    PUTC(ch)     if( fputc(ch, fp) == EOF ) return EOF;
  1507.   
  1508.   
  1509. + #define ARG(signtag) \
  1510. +     _ulong = \
  1511. +         flags&LONGINT ? \
  1512. +             (unsigned long)va_arg(argp, signtag long) : \
  1513. +         (flags&SHORTINT ? \
  1514. +             (unsigned long)(signtag short)va_arg(argp, signtag int) : \
  1515. +              (unsigned long)va_arg(argp, signtag int))
  1516. +      /* shorts are always promoted to ints; thus, it's `va_arg(... int)'
  1517. +       * for `flags&SHORTINT'!
  1518. +       */
  1519.   #define TEN_MUL(X)    ((((X) << 2) + (X)) << 1)
  1520.   
  1521.   #define    todigit(c)    ((c) - '0')
  1522. ***************
  1523. *** 106,111 ****
  1524. --- 116,126 ----
  1525.   
  1526.   #ifdef __FLOATS__
  1527.   # include    "flonum.h"
  1528. + #if defined (__M68881__) || defined (sfp004)
  1529. + static char *exponent __PROTO ((char *, int, int));
  1530. + static int _round __PROTO ((int, char *, char *, char *));
  1531. + static int cvt __PROTO ((double, int, int, char *, int, char *));
  1532. + #else
  1533.   #  if __STDC__
  1534.   static char *exponent(char *, int, int);
  1535.   static char *_round(double, int *, char *, char *, int, char *);
  1536. ***************
  1537. *** 115,120 ****
  1538. --- 130,136 ----
  1539.   static char *_round();
  1540.   static int  cvt();
  1541.   #  endif
  1542. + #endif /* __M68881__ */
  1543.   #endif
  1544.   
  1545.   #if defined(__GNUC__) && (!defined(__NO_INLINE__))
  1546. ***************
  1547. *** 303,309 ****
  1548.               /*FALLTHROUGH*/
  1549.           case 'd':
  1550.           case 'i':
  1551. !             ARG(int);
  1552.               if ((long)_ulong < 0) {
  1553.                   _ulong = -_ulong;
  1554.                   sign = '-';
  1555. --- 319,325 ----
  1556.               /*FALLTHROUGH*/
  1557.           case 'd':
  1558.           case 'i':
  1559. !             ARG(signed);
  1560.               if ((long)_ulong < 0) {
  1561.                   _ulong = -_ulong;
  1562.                   sign = '-';
  1563. ***************
  1564. *** 348,356 ****
  1565.               }
  1566.               else
  1567.                   softsign = 0;
  1568.   /* mjr: check for +-INFINITY */
  1569. !             if (((unsigned long)_dd.i[0] == INF_HI) &&
  1570. !                 ((unsigned long)_dd.i[1] == INF_LO))
  1571.                 {
  1572.                   t = buf;
  1573.                   if(softsign == 0)
  1574. --- 364,386 ----
  1575.               }
  1576.               else
  1577.                   softsign = 0;
  1578. + /* hyc: check for overflows ... */
  1579. +             if (((unsigned long)_dd.i[0] > INF_HI) ||
  1580. +                 ((unsigned long)_dd.i[0] == INF_HI &&
  1581. +                  (unsigned long)_dd.i[1] > INF_LO))
  1582. +               {
  1583. +                 t = buf;
  1584. +                 if(softsign == 0)
  1585. +                 t = strcpy(t, "NaN");
  1586. +                 else
  1587. +                 t = strcpy(t, "-NaN");
  1588. +                 size = strlen(t);
  1589. +                 goto pforw;
  1590. +             }
  1591. +             else    /* Not greater, see if equal to Inf */
  1592.   /* mjr: check for +-INFINITY */
  1593. !             if ((unsigned long)_dd.i[0] == INF_HI)
  1594.                 {
  1595.                   t = buf;
  1596.                   if(softsign == 0)
  1597. ***************
  1598. *** 367,373 ****
  1599.                */
  1600.               *buf = '\0';
  1601.               size = cvt(_double, (int)prec, (int)flags, &softsign,
  1602. !                    *fmt, buf, buf + (int)sizeof(buf)); 
  1603.               if (softsign)
  1604.                   sign = '-';
  1605.               t = *buf ? buf : buf + 1;
  1606. --- 397,407 ----
  1607.                */
  1608.               *buf = '\0';
  1609.               size = cvt(_double, (int)prec, (int)flags, &softsign,
  1610. !                    *fmt, buf
  1611. ! #if !defined (__M68881__) && !defined (sfp004)
  1612. !                    , buf + (int)sizeof(buf)
  1613. ! #endif
  1614. !                    ); 
  1615.               if (softsign)
  1616.                   sign = '-';
  1617.               t = *buf ? buf : buf + 1;
  1618. ***************
  1619. *** 512,517 ****
  1620. --- 546,561 ----
  1621.               for (n = fieldsz; n < dprec; n++)
  1622.                   PUTC('0');
  1623.   
  1624. + #ifdef __FLOATS__
  1625. +             if (fpprec > 0)
  1626. +               {
  1627. +                 /* the number without exponent */
  1628. +                 n = size;
  1629. +                 while (*t != 'e' && *t != 'E' && --n >= 0)
  1630. +                   PUTC (*t++);
  1631. +               }
  1632. +             else
  1633. + #endif
  1634.               /* the string or number proper */
  1635.               for (n = size; --n >= 0; )
  1636.                   PUTC(*t++);
  1637. ***************
  1638. *** 518,523 ****
  1639. --- 562,572 ----
  1640.               /* trailing f.p. zeroes */
  1641.               while (--fpprec >= 0)
  1642.                   PUTC('0');
  1643. + #ifdef __FLOATS__
  1644. +             /* exponent */
  1645. +             while (--n >= 0)
  1646. +               PUTC (*t++);
  1647. + #endif
  1648.               /* left-adjusting padding (always blank) */
  1649.               if (flags & LADJUST)
  1650.                   for (n = realsz; n < width; n++)
  1651. ***************
  1652. *** 536,541 ****
  1653. --- 585,868 ----
  1654.   }
  1655.   
  1656.   #ifdef __FLOATS__
  1657. + #if defined (__M68881__) || defined (sfp004)
  1658. + /* Format of packed decimal (from left to right):
  1659. +     1 Bit: sign of mantissa
  1660. +     1 Bit: sign of exponent
  1661. +     2 Bits zero
  1662. +    12 Bits: three digits exponent
  1663. +     4 Bits unused, fourth (higher order) digit of exponent
  1664. +     8 Bits zero
  1665. +    68 Bits: 17 digits of mantissa, decimal point after first digit
  1666. +   --------
  1667. +    96 Bits == 12 Bytes
  1668. +    All numbers in BCD format.  */
  1669. + #ifdef sfp004
  1670. + /* Note: not tested -- schwab */
  1671. + /* static */ void Format __PROTO ((double number, char *buf));
  1672. + asm ("
  1673. + comm = -6;
  1674. + resp = -16;
  1675. + .text
  1676. + .even
  1677. + _Format:
  1678. +     lea    0xfffffa50:w,a0            | fpu address
  1679. +     lea    sp@(4),a1            | argptr
  1680. +     movew    #0x5400,a0@(comm)        | fmoved -> fp0
  1681. + 1:    cmpw    #0x8900,a0@(resp)
  1682. +     beq    1b
  1683. +     movel    a1@+,a0@
  1684. +     movel    a1@+,a0@
  1685. +     movel    a1@,a1                | get buf
  1686. +     movew    #0x6c11,a0@(comm)        | fmovep fp0,a1@{#17}
  1687. + 1:    cmpw    #0x8900,a0@(resp)
  1688. +     beq    1b
  1689. +     movel    a0@,a1@+
  1690. +     movel    a0@,a1@+
  1691. +     movel    a0@,a1@+
  1692. +     rts
  1693. + ");
  1694. + #endif /* sfp004 */
  1695. +     
  1696. + static int
  1697. + cvt (number, prec, flags, signp, fmtch, startp)
  1698. +      double number;
  1699. +      int prec, flags, fmtch;
  1700. +      char *signp, *startp;
  1701. + {
  1702. +   char buf[12];
  1703. +   char digits[18];
  1704. +   int i;
  1705. +   char *p, *t;
  1706. +   int expcnt;
  1707. +   int gformat = 0, dotrim;
  1708. +   /* Convert to packed decimal.  */
  1709. + #ifdef sfp004
  1710. +   Format (number, buf);
  1711. + #else
  1712. +   asm volatile ("fmovep %0,%1{#17}" : : "f" (number), "m" (buf[0]));
  1713. + #endif
  1714. +   /* Unpack it. */
  1715. +   p = buf + 3;
  1716. +   for (i = 0; i < 17; i++)
  1717. +     digits[i] = ((i & 1 ? *p >> 4 : *p++) & 15) + '0';
  1718. +   digits[i] = 0;
  1719. +   expcnt = ((buf[0] & 15) * 10 + ((buf[1] >> 4) & 15)) * 10 + (buf[1] & 15);
  1720. +   if (buf[0] & 0x40)
  1721. +     expcnt = -expcnt;
  1722. +   t = ++startp;
  1723. +   p = digits;
  1724. +   switch (fmtch)
  1725. +     {
  1726. +     case 'f':
  1727. +       if (expcnt >= 0)
  1728. +     {
  1729. +       *t++ = *p++;
  1730. +       while (expcnt > 0 && *p)
  1731. +         {
  1732. +           *t++ = *p++;
  1733. +           expcnt--;
  1734. +         }
  1735. +       while (expcnt > 0)
  1736. +         {
  1737. +           *t++ = '0';
  1738. +           expcnt--;
  1739. +         }
  1740. +     }
  1741. +       else
  1742. +     {
  1743. +       /* Note: decimal point after the first digit. */
  1744. +       expcnt++;
  1745. +       *t++ = '0';
  1746. +     }
  1747. +       if (prec || flags & ALT)
  1748. +     *t++ = '.';
  1749. +       while (prec > 0 && expcnt < 0)
  1750. +     {
  1751. +       *t++ = '0';
  1752. +       prec--;
  1753. +       expcnt++;
  1754. +     }
  1755. +       while (prec > 0 && *p)
  1756. +     {
  1757. +       *t++ = *p++;
  1758. +       prec--;
  1759. +     }
  1760. +       if (*p)
  1761. +     if (_round (*p, startp, t - 1, signp))
  1762. +       *--startp = '1';
  1763. +       while (prec > 0)
  1764. +     {
  1765. +       *t++ = '0';
  1766. +       prec--;
  1767. +     }
  1768. +       break;
  1769. +     case 'e':
  1770. +     case 'E':
  1771. +     eformat:
  1772. +       *t++ = *p++;
  1773. +       if (prec || flags & ALT)
  1774. +     *t++ = '.';
  1775. +       while (prec > 0 && *p)
  1776. +     {
  1777. +       *t++ = *p++;
  1778. +       prec--;
  1779. +     }
  1780. +       if (*p)
  1781. +     if (_round (*p, startp, t - 1, signp))
  1782. +       {
  1783. +         expcnt++;
  1784. +         *startp = '1';
  1785. +       }
  1786. +       if (!gformat || flags & ALT)
  1787. +     {
  1788. +       while (prec > 0)
  1789. +         {
  1790. +           *t++ = '0';
  1791. +           prec--;
  1792. +         }
  1793. +     }
  1794. +       else
  1795. +     {
  1796. +       /* Suppress trailing zero's. */
  1797. +       while (t > startp && t[-1] == '0')
  1798. +         t--;
  1799. +       if (t[-1] == '.')
  1800. +         t--;
  1801. +     }
  1802. +       t = exponent (t, expcnt, fmtch);
  1803. +       break;
  1804. +     case 'g':
  1805. +     case 'G':
  1806. +       if (prec == 0)
  1807. +     prec++;
  1808. +       /* If the exponent is not less than the precision or less than -4,
  1809. +      use 'e' format, otherwise use 'f' format.  */
  1810. +       if (expcnt >= prec || expcnt < -4)
  1811. +     {
  1812. +       /* Count the significant digit before the decimal point.  */
  1813. +       prec--;
  1814. +       /* 'g'/'G' -> 'e'/'E' */
  1815. +       fmtch -= 2;
  1816. +       gformat = 1;
  1817. +       goto eformat;
  1818. +     }
  1819. +       /* Like 'f', but prec counts significant digits.  */
  1820. +       if (expcnt >= 0)
  1821. +     {
  1822. +       *t++ = *p++;
  1823. +       prec--;
  1824. +       /* Note that prec >= expcnt */
  1825. +       while (expcnt > 0 && *p)
  1826. +         {
  1827. +           *t++ = *p++;
  1828. +           expcnt--;
  1829. +           prec--;
  1830. +         }
  1831. +       while (expcnt > 0)
  1832. +         {
  1833. +           *t++ = '0';
  1834. +           expcnt--;
  1835. +           prec--;
  1836. +         }
  1837. +     }
  1838. +       else
  1839. +     {
  1840. +       *t++ = '0';
  1841. +       expcnt++;
  1842. +     }
  1843. +       if (prec > 0 || flags & ALT)
  1844. +     {
  1845. +       dotrim = 1;
  1846. +       *t++ = '.';
  1847. +     }
  1848. +       else
  1849. +     dotrim = 0;
  1850. +       if (prec > 0)
  1851. +     /* Pad with 0's */
  1852. +     while (expcnt < 0)
  1853. +       {
  1854. +         *t++ = '0';
  1855. +         expcnt++;
  1856. +       }
  1857. +       /* While more precision required and digits left */
  1858. +       while (prec > 0 && *p)
  1859. +     {
  1860. +       *t++ = *p++;
  1861. +       prec--;
  1862. +     }
  1863. +       if (*p)
  1864. +     if (_round (*p, startp, t - 1, signp))
  1865. +       /* Overflow, e.g. 9.999 -> 10.000 */
  1866. +       *--startp = '1';
  1867. +       if (flags & ALT)
  1868. +     {
  1869. +       while (prec > 0)
  1870. +         {
  1871. +           *t++ = '0';
  1872. +           prec--;
  1873. +         }
  1874. +     }
  1875. +       else if (dotrim)
  1876. +     {
  1877. +       /* Strip trailing 0's. */
  1878. +       while (t > startp && *--t == '0');
  1879. +       if (*t != '.')
  1880. +         t++;
  1881. +     }
  1882. +       break;
  1883. +     }
  1884. +   return (int) (t - startp);
  1885. + }
  1886. + static int
  1887. + _round (nxtdig, start, end, signp)
  1888. +      int nxtdig;
  1889. +      char *start, *end;
  1890. +      char *signp;
  1891. + {
  1892. +   if (nxtdig > '4')
  1893. +     {
  1894. +       for (;; --end)
  1895. +     {
  1896. +       if (*end == '.')
  1897. +         --end;
  1898. +       if (++*end <= '9')
  1899. +         break;
  1900. +       *end = '0';
  1901. +       if (end == start)
  1902. +         /* Report overflow, caller must handle appropriately.  */
  1903. +         return 1;
  1904. +     }
  1905. +     }
  1906. +   else if (*signp == '-')
  1907. +     {
  1908. +       for (;; --end)
  1909. +     {
  1910. +       if (*end == '.')
  1911. +         --end;
  1912. +       if (*end != '0')
  1913. +         break;
  1914. +       if (end == start)
  1915. +         *signp = 0;
  1916. +     }
  1917. +     }
  1918. +   return 0;
  1919. + }
  1920. + #else /* !(__M68881__ || sfp004) */
  1921.   static int
  1922.   cvt(number,prec,flags, signp, fmtch, startp, endp)
  1923.       double number;
  1924. ***************
  1925. *** 777,782 ****
  1926. --- 1104,1111 ----
  1927.       return(start);
  1928.   }
  1929.   
  1930. + #endif /* !(__M68881__ || sfp004) */
  1931.   static char *
  1932.   exponent(p, exp, fmtch)
  1933.       register char *p;
  1934. ***************
  1935. *** 807,810 ****
  1936.       }
  1937.       return(p);
  1938.   }
  1939. ! #endif __FLOATS__
  1940. --- 1136,1139 ----
  1941.       }
  1942.       return(p);
  1943.   }
  1944. ! #endif /* __FLOATS__ */
  1945. ===================================================================
  1946. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/fflush.c,v
  1947. retrieving revision 1.11
  1948. diff -c -r1.11 fflush.c
  1949. *** 1.11    1991/07/23 22:06:28
  1950. --- fflush.c    1993/02/18 00:00:21
  1951. ***************
  1952. *** 44,50 ****
  1953.           return(0);
  1954.       f = fp->_flag;
  1955.         if (!(f & (_IORW | _IOREAD | _IOWRT)))  /* file not open */
  1956. !         return(0);
  1957.       if(fp->_cnt > 0)             /* data in the buffer */
  1958.           {
  1959.             if(f & _IOWRT)                /* writing */
  1960. --- 44,50 ----
  1961.           return(0);
  1962.       f = fp->_flag;
  1963.         if (!(f & (_IORW | _IOREAD | _IOWRT)))  /* file not open */
  1964. !         return(EOF);
  1965.       if(fp->_cnt > 0)             /* data in the buffer */
  1966.           {
  1967.             if(f & _IOWRT)                /* writing */
  1968. ===================================================================
  1969. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/fread.c,v
  1970. retrieving revision 1.15
  1971. diff -c -r1.15 fread.c
  1972. *** 1.15    1992/12/18 16:35:48
  1973. --- fread.c    1993/02/20 05:51:59
  1974. ***************
  1975. *** 120,125 ****
  1976. --- 120,126 ----
  1977.             ptr = data + cnt;
  1978.           cnt -= ptr - data;
  1979.           n -= ptr - data;
  1980. +         l += ptr - data;
  1981.           data = ptr;
  1982.           while( cnt>0 ) {
  1983.               if( *ptr!='\r' ) {
  1984. ===================================================================
  1985. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/getpass.c,v
  1986. retrieving revision 1.2
  1987. diff -c -r1.2 getpass.c
  1988. *** 1.2    1992/10/09 20:35:29
  1989. --- getpass.c    1993/02/22 06:15:12
  1990. ***************
  1991. *** 2,28 ****
  1992.   #include <stdio.h>
  1993.   #include <unistd.h>
  1994.   #include <string.h>
  1995.   
  1996.   char *
  1997.   getpass(prompt)
  1998.       const char *prompt;
  1999.   {
  2000. !     static char buf[81];
  2001.           char *ret;
  2002.       struct sgttyb oldsb, newsb;
  2003.   
  2004.       fflush(stdin);
  2005. !     gtty(0, &oldsb);
  2006.       newsb = oldsb;
  2007.       newsb.sg_flags &= ~ECHO;
  2008. !     stty(0, &newsb);
  2009. !     fputs(prompt, stderr); fflush(stderr);
  2010. !     buf[0] = buf[81] = 0;
  2011. !     if((ret = fgets(buf, 80, stdin)) != 0)
  2012.       {
  2013. !         /* null terminate string */
  2014.           buf[strlen(buf) - 1] = 0;
  2015.       }
  2016. !     stty(0, &oldsb);
  2017.       return ret;
  2018.   }
  2019. --- 2,43 ----
  2020.   #include <stdio.h>
  2021.   #include <unistd.h>
  2022.   #include <string.h>
  2023. + #include <limits.h>
  2024.   
  2025. + extern int __mint;
  2026.   char *
  2027.   getpass(prompt)
  2028.       const char *prompt;
  2029.   {
  2030. !     static char buf[PASS_MAX + 1];
  2031.           char *ret;
  2032.       struct sgttyb oldsb, newsb;
  2033. +     FILE *tty;
  2034. +     int ttyfd = 0;
  2035.   
  2036.       fflush(stdin);
  2037. !     tty = stdin;
  2038. !     if (__mint) {
  2039. !         if ((tty = fopen("U:\\DEV\\TTY", "r")) == NULL)
  2040. !             return NULL;
  2041. !     }
  2042. !     ttyfd = fileno(tty);
  2043. !     fflush(tty);
  2044. !     gtty(ttyfd, &oldsb);
  2045.       newsb = oldsb;
  2046.       newsb.sg_flags &= ~ECHO;
  2047. !     stty(ttyfd, &newsb);
  2048. !     fputs(prompt, stderr);
  2049. !     fflush(stderr);
  2050. !     if ((ret = fgets(buf, PASS_MAX + 1, tty)) != 0)
  2051.       {
  2052. !       /* zap the newline */
  2053. !       if (buf[strlen(buf) - 1] == '\n')
  2054.           buf[strlen(buf) - 1] = 0;
  2055.       }
  2056. !     stty(ttyfd, &oldsb);
  2057. !     if (__mint)
  2058. !         (void) fclose(tty);
  2059.       return ret;
  2060.   }
  2061. ===================================================================
  2062. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/getuid.c,v
  2063. retrieving revision 1.9
  2064. diff -c -r1.9 getuid.c
  2065. *** 1.9    1992/09/14 14:56:40
  2066. --- getuid.c    1993/02/18 00:00:27
  2067. ***************
  2068. *** 28,34 ****
  2069.   
  2070.       if (__mint) {
  2071.           r = Psetuid(x);
  2072. !         if (r) {
  2073.               errno = (int) -r;
  2074.               return -1;
  2075.           }
  2076. --- 28,34 ----
  2077.   
  2078.       if (__mint) {
  2079.           r = Psetuid(x);
  2080. !         if (r < 0) {
  2081.               errno = (int) -r;
  2082.               return -1;
  2083.           }
  2084. ***************
  2085. *** 45,51 ****
  2086.   
  2087.       if (__mint) {
  2088.           r = Psetgid(x);
  2089. !         if (r) {
  2090.               errno = (int) -r;
  2091.               return -1;
  2092.           }
  2093. --- 45,51 ----
  2094.   
  2095.       if (__mint) {
  2096.           r = Psetgid(x);
  2097. !         if (r < 0) {
  2098.               errno = (int) -r;
  2099.               return -1;
  2100.           }
  2101. ===================================================================
  2102. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/regexp.c,v
  2103. retrieving revision 1.6
  2104. diff -c -r1.6 regexp.c
  2105. *** 1.6    1992/11/06 23:02:09
  2106. --- regexp.c    1993/02/18 00:00:30
  2107. ***************
  2108. *** 32,38 ****
  2109.   #include <string.h>
  2110.   #include <regexp.h>
  2111.   #include <stdio.h>
  2112. ! #include <sys/types.h>
  2113.   #ifndef _COMPILER_H
  2114.   #include <compiler.h>
  2115.   #endif
  2116. --- 32,42 ----
  2117.   #include <string.h>
  2118.   #include <regexp.h>
  2119.   #include <stdio.h>
  2120. ! #ifdef __TURBOC__
  2121. ! # include <sys\types.h>
  2122. ! #else
  2123. ! # include <sys/types.h>
  2124. ! #endif
  2125.   #ifndef _COMPILER_H
  2126.   #include <compiler.h>
  2127.   #endif
  2128. ===================================================================
  2129. RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/strlwr.c,v
  2130. retrieving revision 1.1
  2131. diff -c -r1.1 strlwr.c
  2132. *** 1.1    1989/03/19 22:30:52
  2133. --- strlwr.c    1993/02/18 00:00:32
  2134. ***************
  2135. *** 1,15 ****
  2136.   #include <ctype.h>
  2137.   
  2138.   char *strlwr(string)
  2139. !     register char *string;
  2140. !     {
  2141. !     register char *p = string;
  2142.   
  2143. !     while(*string)
  2144. !         {
  2145. !         if(isupper(*string))
  2146. !             *string ^= 0x20;
  2147. !         ++string;
  2148. !         }
  2149. !     return(p);
  2150. !     }
  2151. --- 1,18 ----
  2152.   #include <ctype.h>
  2153.   
  2154.   char *strlwr(string)
  2155. ! register char *string;
  2156. ! {
  2157. !     register char *p = string;
  2158.   
  2159. !     if(p) 
  2160. !     {
  2161. !         while(*string)
  2162. !         {
  2163. !             if(isupper(*string))
  2164. !                 *string ^= 0x20;
  2165. !             ++string;
  2166. !         }
  2167. !     }
  2168. !     return(p);
  2169. ! }
  2170.